package com.renwenhao.dao.register.impl;

import com.renwenhao.dao.register.RegisterDao;
import com.renwenhao.enyity.User;
import com.renwenhao.util.DruidUtil;
import org.springframework.jdbc.core.JdbcTemplate;

public class RegisterDaoImpl implements RegisterDao {
    private JdbcTemplate jdbcTemplate = new JdbcTemplate(DruidUtil.getDataSource());
    @Override
    public int addUser(User u) {
        String sql = "insert into user(username,password) values(?,?)";
//        int update = jdbcTemplate.update(sql, u.getUsername(), u.getPassword());
        int update = jdbcTemplate.update(sql, u.getUsername(), u.getPassword());
        return update;
    }
}
